﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Member.aspx.cs" Inherits="Quantringuoidung_Member" Title="Untitled Page" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
       </script>

        </telerik:RadCodeBlock>
 
 <table cellpadding="0" cellspacing="0"  style="margin-left:100px;">
    <tr><td colspan="3" align="center"><h2>Thêm mới Tài khoản</h2></td></tr>
            <tr>
                 <td style="width: 100px; height: 19px;">
                  Username:
                 </td>
                <td style="width: 400px; height: 19px;">                  
                    <asp:TextBox ID="txtuser" runat="server"/></td>
                  
                 <td style="width: 100px; height: 19px;">
                  Password:
                 </td>    
                <td style="width: 400px; height: 19px;">                    
                    <asp:TextBox ID="txtPassword" runat="server" Width="180px" TextMode="Password"></asp:TextBox>
                    
                  </td>
           
           </tr>  
           <tr>      
                <td style="width: 100px; height: 19px;">
                 FullName:
                </td> 
                <td style="width: 400px; height: 19px;">                   
                    <asp:TextBox ID="txtname" runat="server"/>   
                </td>
                
                 <td style="width: 100px; height: 19px;">
                  Address:
                 </td>
                <td style="width: 400px; height: 19px;">                    
                    <asp:TextBox ID="txtAD" runat="server"/></td>
             </tr>
              <tr>              
                
                 <td style="width: 100px; height: 19px;">
                   Email:
                 </td>
                <td style="width: 400px; height: 19px;">                   
                    <asp:TextBox ID="txtemail" runat="server"/></td> 
                    
                <td style="width: 100px; height: 19px;">
                  Phone:
                 </td>            
                <td style="width: 400px; height: 19px;">                   
                    <asp:TextBox runat="server" ID="txtphone"/></td>
           </tr>
              <tr>
               <td style="width: 100px; height: 19px;">
                  Ngày sinh:
                 </td>
                <td style="width: 400px; height: 19px;">                    
                    <telerik:RadDatePicker ID="RadDatePicker_nsinh" runat="server"/>
                   
                </td>
                
                 <td style="width: 100px; height: 19px;">
                  Is Admin:
                 </td>
                <td style="width: 400px; height: 19px;">                   
                    <asp:CheckBox ID="checkIsadmin" runat="server" Checked="false"/></td>
              </tr>
             
             <tr>
                <td style="width: 100px">
                   </td>
            </tr>
        </table>
        <table cellpadding="0" cellspacing="0"  style="margin-left:100px;">
             <tr><td style="height:20px"></td></tr>
             <tr><td>
              <telerik:RadButton ID="Them" runat="server" Text="Add New" OnClick="Button1_Click" />
              </td>
              <td style="width:20px"></td>
              <td>
              <telerik:RadButton ID="refesh" runat="server" Text="Refesh" onclick="refesh_Click"/>
              </td>
              </tr></table><br />
      <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>  


<telerik:RadGrid ID="RadGrid_user" GridLines="None" runat="server" AllowAutomaticDeletes="True"
            AllowPaging="True" AutoGenerateColumns="False"  DataSourceID="sql_user" OnItemDeleted="RadGrid_user_ItemDeleted"          
           AllowSorting="True" CellSpacing="0">
            <PagerStyle Mode="NextPrevAndNumeric" />


            <MasterTableView Width="100%" DataKeyNames="Username"
                 DataSourceID="sql_user" HorizontalAlign="NotSet" 
                AutoGenerateColumns="False">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                 <Columns>
                
                    <telerik:GridBoundColumn DataField="Username" HeaderText="Username" SortExpression="Username"
                        UniqueName="Username" DataType="System.String" >
                    </telerik:GridBoundColumn>
                    
                     <telerik:GridBoundColumn DataField="Password" 
                        HeaderText="Password" Display="false" MaxLength="6"
                        SortExpression="Password" UniqueName="Password">
                   </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn DataField="FullName" 
                        HeaderText="FullName" 
                        SortExpression="FullName" UniqueName="FullName">
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="Address" 
                        HeaderText="Address" 
                        SortExpression="Address" UniqueName="Address">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Email" 
                        HeaderText="Email" 
                        SortExpression="Email" UniqueName="Email">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn DataField="Phone" 
                        HeaderText="Phone" 
                        SortExpression="Phone" UniqueName="Phone">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="Birthday" HeaderText="Ngày sinh" UniqueName="Birthday">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridCheckBoxColumn DataField="IsAdmin" HeaderText="IsAdmin" UniqueName="IsAdmin">
                    </telerik:GridCheckBoxColumn>
                    
                    
                    <telerik:GridButtonColumn ConfirmText="Delete this Admin?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings ColumnNumber="2" CaptionDataField="Password" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Product">
                   <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                    <FormCaptionStyle></FormCaptionStyle>
                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>
        
        
        <asp:SqlDataSource ID="sql_user" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
           SelectCommand="SELECT * FROM [Admin1]"
            DeleteCommand="DELETE FROM [Admin1] WHERE [Username] = @original_Username" 
           
            
           OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
          
           
           <DeleteParameters>
                <asp:Parameter Name="original_Username" Type="String" />
            </DeleteParameters>
         
           
       </asp:SqlDataSource>
        

</asp:Content>

